<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
  <style>
    body {
      height: 100vh;
      background-color: black;
      display: flex;
      align-items: center;
      justify-content: center;
    }

    .box {
      width: 600px;
      height: 10px;
      border-radius: 5px;
      background: gray;
      overflow: hidden;
    }

    .progress {
      width: 100%;
      height: 100%;
      background: linear-gradient(-45deg, skyblue 25%, green 0, green 50%, skyblue 0, skyblue 75%, green 0%);
      background-size: 12px 12px;
      border-radius: inherit;
      animation: anim 30s linear infinite;
      transform: translateX(-50%);
      /* background: red; */
      /* 过度效果 */
      transition: transform .2s linear;
    }

    @keyframes anim {
      to {
        background-position: 200% 0;
      }
    }
  </style>
</head>
<body>
  <div class="box">
    <div class="progress"></div>
  </div>

</body>
<script>
  const progress = document.querySelector('.progress')

  let count = 1

  // 进度条移动
  function frame() {
    progress.style.transform = `translateX(${count - 100}%)`
    count++

    if (count > 100) {
      count = 0
    }

  }

  setInterval(() => {
    frame()
  }, 200);
</script>
</html>